﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Artemis;

namespace JAWWS
{
    class HealthShield : Actor
    {
        private int transparency;
        private GLUquadric quadric;

        public HealthShield()
        {
            this.transparency = 100;

            quadric = GLU.gluNewQuadric();
            GLU.gluQuadricDrawStyle(quadric, GLenum.GLU_FILL);
            GLU.gluQuadricNormals(quadric, GLenum.GLU_SMOOTH);
        }
        public void move(Player player)
        {
            Position = player.getCamera().getCam();
            updateShield();
        }
        public void updateShield()
        {
            GL.glPushMatrix();
            GL.glLoadIdentity();
            GL.glTranslatef((float)Position.GetValue(0), (float)Position.GetValue(1), (float)Position.GetValue(2));
            GL.glGetFloatv(GLenum.GL_MODELVIEW_MATRIX, this.LocalTransMatrix);
            GL.glPopMatrix();
        }
        public override void draw()
        {
            //does nothing
        }
        public void draw(Player player)
        {
            float[] ambient = { 0.1f, 0.0f, 0.0f, 0.1f };
            float[] diffuse = { 0.1f, 0.0f, 0.0f, 0.1f };
            float[] specular = { 0.8f, 0.6f, 0.6f, 1.0f };
            float shininess = 32.0f;
            GL.glPushMatrix();
                GL.glMaterialfv(GLenum.GL_FRONT_AND_BACK, GLenum.GL_AMBIENT, ambient);
                GL.glMaterialfv(GLenum.GL_FRONT_AND_BACK, GLenum.GL_DIFFUSE, diffuse);
                GL.glMaterialfv(GLenum.GL_FRONT_AND_BACK, GLenum.GL_SPECULAR, specular);
                GL.glMaterialf(GLenum.GL_FRONT_AND_BACK, GLenum.GL_SHININESS, shininess);
                GL.glDepthMask((byte)GLenum.GL_FALSE);
                GL.glTranslatef(player.getPosition()[0], player.getPosition()[1], player.getPosition()[2]);
                GLU.gluSphere(quadric, 1.0, 10, 10);
                //GLU.gluCylinder(quadric, 1.0, 1.0, 1.0, 90, 90);
                GL.glDepthMask((byte)GLenum.GL_TRUE);
            GL.glPopMatrix();
        }
        public override void attack(Actor player)
        {
            //does nothing
        }

        public override void attack(Actor actor, Projectile proj)
        {
            //throw new NotImplementedException();
        }
        public override void respawn()
        {
            // this = new Enemy(level, weapon);
        }

        public float[] getPos()
        {
            return Position;
        }
    }
}
